package day20180129.designMode.eight_AbstratFactory;

import com.sun.deploy.panel.ITreeNode;

import java.util.Iterator;

/**
 * Created by 14394 on 2018/1/29.
 */
public class TablePage extends Page {

    public TablePage(String title, String author) {
        super(title, author);
    }

    @Override
    protected String makeHTML() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("<html><head><title>"+title+"</title></head>\n");
        buffer.append("<body>\n");
        buffer.append("<h1>"+title + "</h1>\n");
        buffer.append("<table width=\"80%\" border = \"3\">\n");
        Iterator it= content.iterator();
        while (it.hasNext()){
            Item item = (Item) it.next();
            buffer.append("<tr>"+item.makeHTML() + "</tr>");
        }
        buffer.append("</table>\n");
        buffer.append("<hr><address>"+author + "</address>");
        buffer.append("</body></html>\n");
        return buffer.toString();
    }
}
